<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------

Route::get('think', function () {
    return 'hello,ThinkPHP5!';
});

/*
* 工具路由
*/
//base64上传图片接口
Route::post('upload_base64', 'admin/ToolController/upload_base64');
//file对象上传图片接口
Route::post('upload_file', 'admin/ToolController/uploadAjax');

/*
* 登录及用户路由
*/
Route::group('user/',function(){
    //显示用户列表
    Route::get('index', 'index');
    //登录
    Route::post('save', 'save');

})->prefix('admin/UserController/')->pattern(['id' => '\d+']);

/*
* 分类路由
*/
Route::group('cate/',function(){
    //分类列表
    Route::get('index', 'index');
    //添加分类
    Route::post('save', 'save');
    //查询单条分类数据
    Route::get('edit/:id', 'edit');
    //修改分类
    Route::post('update', 'update');
    //删除分类
    Route::get('delete/:id', 'delete');

})->prefix('admin/CateController/')->pattern(['id' => '\d+']);

/*
* 轮播图路由
*/
Route::group('carousel/',function(){
    //轮播图列表
    Route::get('index', 'index');
    //添加轮播图
    Route::post('save', 'save');
    //查询单条轮播图数据
    Route::get('edit/:id', 'edit');
    //修改轮播图
    Route::post('update', 'update');
    //删除轮播图
    Route::get('delete/:id', 'delete');

})->prefix('admin/CarouselController/')->pattern(['id' => '\d+']);

/*
* 自我介绍和关于店铺路由
*/
Route::group('about/',function(){
    //自我介绍或关于店铺列表
    Route::get('index', 'index');
    //添加自我介绍或关于店铺
    Route::post('save', 'save');
    //修改自我介绍或关于店铺
    Route::post('update', 'update');
    //删除
    // Route::get('delete/:id', 'delete');

})->prefix('admin/AboutController/')->pattern(['id' => '\d+']);

/*
* 商品路由
*/
Route::group('goods/',function(){
    //商品列表
    Route::get('index', 'index');
    //添加商品
    Route::post('save', 'save');
    //查询单条商品数据
    Route::get('edit/:id', 'edit');
    //修改商品
    Route::post('update', 'update');
    //删除商品
    Route::get('delete', 'delete');

})->prefix('admin/GoodsController/')->pattern(['id' => '\d+']);

/*
* 商品规格路由
*/
Route::group('specs/',function(){
    //规格列表
    Route::get('index', 'index');
    //添加规格
    Route::post('save', 'save');
    //查询单条规格数据
    Route::get('edit/:id', 'edit');
    //修改规格
    Route::post('update', 'update');
    //删除规格
    Route::get('delete/:id', 'delete');

})->prefix('admin/SpecsController/')->pattern(['id' => '\d+']);

/*
* 购物车路由
*/
Route::group('cart/',function(){
    //购物车商品列表
    Route::get('index', 'index');
    //加入购物车
    Route::post('save', 'save');
    //查询单条购物车数据
    Route::get('edit/:id', 'edit');
    //修改购物车商品数量
    Route::post('update', 'update');
    //购物车商品数量+1
    Route::post('plus', 'plus');
    //购物车商品数量-1
    Route::post('reduce', 'reduce');
    //删除购物车商品，一个或多个(1,2,3)
    Route::get('delete', 'delete');

})->prefix('admin/CartController/')->pattern(['id' => '\d+'])->middleware('check');

/*
* 订单路由
*/
Route::group('order/',function(){
    //后台所有订单列表
    Route::get('index', 'index');
    //前台用户订单列表
    Route::get('user/index', 'userIndex');
    //生成订单
    Route::post('save', 'save');
    //后台管理修改订单状态为配送当中
    Route::get('distribution/:id', 'distribution');
    //前台用户确认收货
    Route::get('user/confim/:id', 'userConfirm');
    // 前台用户提交退款信息
    Route::post('user/refund', 'userRefund');

})->prefix('admin/OrderController/')->pattern(['id' => '\d+'])->middleware('check');

/*
* 微信支付路由  1已付款 2配送当中 3订单已完成 4退款当中 5退款已完成
*/
Route::group('payment/',function(){
    //支付  前台用户付款
    Route::post('save', 'save');
    //支付异步通知接口
    Route::get('notifyUrlApi', 'notifyUrlApi');
    //退款
    Route::post('agree', 'agree');

})->prefix('admin/PaymentController/')->pattern(['id' => '\d+']);

/*
* 穿线预约路由
*/
Route::group('threading/',function(){
    //后台显示预约订单
    Route::get('index', 'index');
    //前台提交预约单
    Route::post('save', 'save');
    //后台管理添加备注信息
    Route::post('update', 'update');

})->prefix('admin/ThreadingController/')->pattern(['id' => '\d+']);
